home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / jcool01.zip / EX6_10.C < prev    next >
C/C++ Source or Header  |  1992-09-25  |  1KB  |  27 lines

  1. //
  2. // Copyright (C) 1991 Texas Instruments Incorporated.
  3. //
  4. // Permission is granted to any individual or institution to use, copy, modify,
  5. // and distribute this software, provided that this complete copyright and
  6. // permission notice is maintained, intact, in all copies and supporting
  7. // documentation.
  8. //
  9. // Texas Instruments Incorporated provides this software "as is" without
  10. // express or implied warranty.
  11. //
  12.  
  13. #include <cool/Matrix.h>            // COOL Matrix class
  14.  
  15. #include <cool/Matrix.C>
  16.  
  17. int main (void) {
  18.   CoolMatrix<int> mc1(3,4),mc2(3,4);        // Two 3x4 matrices of integer
  19.   for (int i = 0; i < 3; i++)            // For each row in CoolMatrix
  20.     for (int j = 0; j < 4; j++)         // For each column in CoolMatrix
  21.       mc1.put(i,j,(i+2)*(j+3));            // Assign element value
  22.   mc2 = mc1 + 5;                // Copy CoolMatrix with added value
  23.   mc1 = mc1 + mc2;                // Add the matrices together
  24.   cout << mc1 << "\n" << mc2;            // Output the starting matrices
  25.   return (0);                    // Exist with OK status
  26. }
  27.